<?php

namespace App\Services\Auth;

use EasyWeChat\Factory;
use EasyWeChat\Kernel\Exceptions\InvalidConfigException;

class WxService
{

    public $miniProgramApp;

    // 订阅消息跳转地址
    public $subscribeUrl = 'pages/detail/index?id=%s';


    public function __construct()
    {
        $this->miniProgramApp = Factory::miniProgram(config('wechat.mini_program.default'));
    }

    /**
     * @throws InvalidConfigException
     */
    public function getUserSession($code)
    {
        return $this->miniProgramApp->auth->session($code);
    }
}
